package com.gbits.app.finance.service;

import org.hibernate.SessionFactory;

import com.gbits.app.finance.dao.BaseDaoImpl4Hibernate4;
import com.gbits.app.finance.dao.IBaseDao;

public abstract class DefaultAbstractService<E> extends AbstractService<E> {

	private SessionFactory sessionFactory;
	private IBaseDao<E> baseDao;
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}
	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	@Override
	public IBaseDao<E> getBaseDao() {
		synchronized (this) {
			if (null == baseDao) {
				this.baseDao = new BaseDaoImpl4Hibernate4<E>(this.getSessionFactory());
			}
		}
		return this.baseDao;
	}

}
